\documentclass[12pt,a4paper]{article}
\usepackage{xeCJK}
\usepackage{ctex}
\usepackage{booktabs}
\usepackage{makecell}
\usepackage{geometry}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{graphicx}
\usepackage{wrapfig}
\usepackage{abstract}
\usepackage{float}
\usepackage{algorithmicx}
\usepackage[ruled]{algorithm}
\usepackage{algpseudocode}
\usepackage{xcolor}
\usepackage{setspace}
\usepackage{color}
\usepackage{bm}
\usepackage{url}
\usepackage{cite}
\usepackage{array}
\usepackage{textcomp}
\usepackage{appendix}
\usepackage{listings}

\setstretch{1.2} 
\setlength{\parindent}{0.8cm}
\geometry{left=3cm,right=3cm,top=2.5cm,bottom=2.5cm}

\title{\vspace{-2cm} \textbf{第十一次课堂作业}}

\author{邵柯欣 \\学号：3200103310 \\课程名称：数据科学的数学基础}

\date{\today}

\begin{document}
\maketitle
\section{一}
\[
A =
\begin{bmatrix}
2 & 3 \\
1 & -1 \\
-1 & 2 \\
\end{bmatrix}
\]
\subsection{寻找$A$的秩1近似$P$，使得$\sum^3_{i = 1}\|a_i - \pi_P(a_i)\|$最小}
Solution:\\
\[
A^TA =
\begin{bmatrix}
  6 & 3 \\
  3 & 14 \\
\end{bmatrix}
= VS^TSV^T, \quad
\lambda(A^TA) =
\begin{bmatrix}
  15 \\
  5 \\
\end{bmatrix}
\]
\[
\therefore \quad S^TS =
\begin{bmatrix}
  15 & 0 \\
  0 & 5 \\
\end{bmatrix}
\]
\[
\therefore \quad P = V(:,1) =
\begin{bmatrix}
  \frac{1}{\sqrt{10}} \\
  \frac{3}{\sqrt{10}} \\
\end{bmatrix}
\]
\subsection{寻找秩1矩阵$B \in \mathbb{R}^{3*2}$，使得$\|A - B\|^2_2$最小}
Solution:\\
$$\because \quad A = USV^T$$
\[
V =
\begin{bmatrix}
  \frac{1}{\sqrt{10}} & \frac{-3}{\sqrt{10}} \\
  \frac{3}{\sqrt{10}} & \frac{1}{\sqrt{10}} \\
\end{bmatrix},
S =
\begin{bmatrix}
  \sqrt{15} & 0 \\
  0 & \sqrt{5} \\
\end{bmatrix}
\]
\[
\therefore \quad U =
\begin{bmatrix}
  \frac{11\sqrt{6}}{30} & -\frac{3\sqrt{2}}{10} \\
  -\frac{\sqrt{6}}{15} & -\frac{2\sqrt{2}}{5} \\
  \frac{\sqrt{6}}{6} & \frac{\sqrt{2}}{2} \\
\end{bmatrix}
\]
\[
B = U1S1V1 =
\begin{bmatrix}
  \frac{11}{10} & \frac{33}{10} \\
  -\frac{1}{5} & -\frac{3}{5} \\
  \frac{1}{2} & \frac{3}{2} \\
\end{bmatrix}
\]
\section{二}
\[
D =
\begin{bmatrix}
d_1 & 0 & 0 \\
0 & d_2 & 0 \\
0 & 0 & d_3 \\
\end{bmatrix}
d_1 \ge d_2 \ge d_3 \ge 0
\]
\subsection{证明$max_P tr(P^TDP) = d_1 + d_2.(P \in \mathbb{R}^{3*2}, P^TP = I)$}
Proof:\\
设$P = [P_{ij}](i \in {1, 2, 3},\quad j \in {1, 2})$\\
$\because \quad P^TP = I$\\
\begin{align}
  \therefore \quad P_{11}^2 + P_{21}^2 + P_{31}^2 =& 1 \notag \\
  P_{12}^2 + P_{22}^2 + P_{32}^2 =& 1 \notag
\end{align}
\begin{align}
  \therefore \quad tr(PDP^T) =& tr(DPP^T) \notag \\
  =& (d_1 - d_3)*(P_{11}^2 + P_{12}^2) + (d_1 - d_2)*(P_{21}^2 + P_{22}^2) + 2*d_3 \notag \\
  \le& (d_1 - d_3)*1 + (d_1 - d_2)*1 + 2*d_3 \notag \\
  =& d_1 + d_2 \notag
\end{align}
\end{document}
